package com.jidong.test_springboot.shiro;


import org.apache.shiro.authc.AuthenticationToken;

import com.jidong.test_springboot.util.JWTUtil;

public class JwtToken implements AuthenticationToken{

	private String token;
	
	public JwtToken(String token) {
		this.token=token;
	}

	
	/*获取token中的用户名用的方法**/
	@Override
	public Object getPrincipal() {
		return JWTUtil.getClaim(token, "username");
	}
	
	/*获取token中的密码用的方法****/
	@Override
	public Object getCredentials() {
		return JWTUtil.getClaim(token, "password");
	}
	
	
	
	public boolean isTimeout() {
		return JWTUtil.isTimeout(token);
	}


	public String getToken() {
		return token;
	}
	
	
	
	
	
}
